// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   getInsertSql.java

package include.get_sql;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;

public class getInsertSql
{

	private String dbase;
	private String tableName;
	private nseer_db erp_db;

	public getInsertSql()
	{
		dbase = "";
		tableName = "";
	}

	public String sql(String database, String tName)
	{
		dbase = database;
		tableName = tName;
		String sql = "";
		erp_db = new nseer_db(dbase);
		try
		{
			String sql1 = (new StringBuilder("select * from ")).append(tableName).toString();
			ResultSet rs = erp_db.executeQuery(sql1);
			ResultSetMetaData rsmd = rs.getMetaData();
			int number = rsmd.getColumnCount();
			for (int i = 2; i < number; i++)
				sql = (new StringBuilder(String.valueOf(sql))).append(rsmd.getColumnName(i)).append(",").toString();

			sql = (new StringBuilder(String.valueOf(sql))).append(rsmd.getColumnName(number)).toString();
			erp_db.close();
		}
		catch (Exception exception) { }
		return sql;
	}
}
